//
//  AppDelegate.m
//  LYTabbarDemo
//
//  Created by 刘宇 on 16/6/23.
//  Copyright © 2016年 liuyu. All rights reserved.
//

#import "AppDelegate.h"
// :: Other ::
#import "FirstViewController.h"
#import "FourthViewController.h"
#import "LYTabbarController.h"
#import "SecondViewController.h"
#import "ThirdViewController.h"
#import "LYTabbarController.h"
@interface AppDelegate ()<LYTabbarControllerDelegate>

@end

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.
    
    /**
     *  第一步：定义各个视图
     */
    FirstViewController *firstVC = [[FirstViewController alloc]init];
    firstVC.title = @"首页";
    SecondViewController    *secVC = [[SecondViewController alloc]init];
    secVC.title = @"个人";
    ThirdViewController *thirdVC = [[ThirdViewController alloc]init];
    thirdVC.title = @"第三";
    FourthViewController    *fourthVC = [[FourthViewController alloc]init];
    fourthVC.title = @"第四";
    
    /**
     *  第二部：添加各个视图数组、item图片数组、item选中后的图片数组
     */
    LYTabbarController  *tabbarController = [[LYTabbarController alloc]init];
    [tabbarController addChildViewControllers:@[firstVC,secVC,thirdVC,fourthVC] images:@[@"home",@"home",@"person",@"person"] selectedImages:@[@"home_selected",@"home_selected",@"person_selected",@"person_selected"]];
    /**
     *  第三部：设置中间按钮 不设置，默认尺寸（50，50），偏移量0.5居中显示
     */
//    tabbarController.centerImage = [UIImage imageNamed:@"center"];  //设置按钮图片
//    tabbarController.centerSelectedImage = [UIImage imageNamed:@"center_selected"]; //设置按钮高亮图片
//    tabbarController.centerButtonOffset = 0.4;  //设置按钮的上下偏移量
//    tabbarController.centerBounds = CGRectMake(0, 0, 60, 60);   //设置按钮尺寸
//    tabbarController.centerButtonStyle = LYCenterButtonStyleBulge;  //设置按钮的背景图片中间是否凸起，默认不凸起
    
    self.window.rootViewController = tabbarController;
    
    
    return YES;
}
- (void)tabBarDidClickCenterButton
{
    NSLog(@"点击了中间按钮");
}
- (void)tabBarController:(LYTabbarController    *)tabbarController error:(LYError)error
{
    NSLog(@"出错");
}
- (void)applicationWillResignActive:(UIApplication *)application {
    // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
    // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}

- (void)applicationDidEnterBackground:(UIApplication *)application {
    // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
    // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

- (void)applicationWillEnterForeground:(UIApplication *)application {
    // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}

- (void)applicationDidBecomeActive:(UIApplication *)application {
    // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

- (void)applicationWillTerminate:(UIApplication *)application {
    // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}

@end
